﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    textarea.form-control {
        padding:0px 0px;
    }
    .form .formValue textarea.form-control {
        padding-left:0px;
    }
</style>
<script>
    $(function () {
        FindEntity();
    });   

    function FindEntity() {
        var F_Id = $.request("F_Id");
        $.ajax({
            url: "/OrderFlowManage/ClientOrder/GetSaleReportEntity?F_Id=" + F_Id + "",
            dataType: "json",
            async: false,
            success: function (data) {
                if (data != null) {
                    $("#F_ReportTitle").val(data["F_ReportTitle"]);
                    $("#F_Context").val(data["F_Context"]);
                }
            }, error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
    }

    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }

        var orderId = $.request("orderId");
        var F_OrderStep = $.request("F_OrderStep");
        var F_ReportTitle = $("#F_ReportTitle").val();
        var F_Context = $("#F_Context").val();
        var F_Id = $.request("F_Id");
        $.submitForm({
            url: "/OrderFlowManage/ClientOrder/SubmitReportForm?orderId=" + orderId + "&F_OrderStep=" + F_OrderStep + "&F_Id=" + F_Id,
            param: $("#form1").formSerialize(),
            success: function () {                
                if ($.request("F_Id") != null) {                  
                    $.currentWindow().$("#gridList").trigger("reloadGrid");                   
                } 
                $.loading(false);
            }
        });
    }
</script>
<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">标题</th>
                <td class="formValue">
                    <input id="F_ReportTitle" name="F_ReportTitle" type="text" class="form-control required" placeholder="请输入标题" />
                </td>
            </tr>
            <tr>
                <td class="formTitle">内容</td>
                <td class="formValue">
                    <textarea id="F_Context" name="F_Context" rows="8" class="form-control required" placeholder="请输入内容"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>
